<template>
  <div class="content">
    <div class="order_details">
      <div class="order_top">
        <time>金额</time><span ref="amounts">{{details.amount}}</span>
      </div>
      <div class="order_bottom">
        <p><time>类型</time><span>{{details.remark}}</span></p>
        <p><time>时间</time><span>{{details.create_time | dates}}</span></p>
        <p><time>单号</time><span>{{details.provider_uid}}</span></p>
        <p><time>备注</time><span>{{details.types}}</span></p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      details: ''
    }
  },
  mounted () {
    this.$apiPost('amount_detail',{'id':this.$route.params.id}).then((data) => {
      this.details = data.data
      if(this.details.amount*1 >= 0) {
        this.$refs.amounts.style.color = '#5CC547'
        this.$refs.amounts.innerHTML = `+${this.details.amount}`
      } else {
        this.$refs.amounts.style.color = 'red'
      }
    })
  },
  filters: {
    dates (str) {
      var time = new Date(str*1000)
      return time.toLocaleDateString()
    }
  }
}
</script>
<style scoped lang='scss'>
.order_details{
  width: 100%;
  height: 188px;
  background: #fff;
  padding: 0 16px 0 16px;
  margin-top:10px;
  .order_top{
    width: 100%;
    height: 50px;
    line-height: 50px;
    border-bottom: 1px solid #E5E5E5;
    font-size: 16px;
    time{
      float: left;
    }
    span{
      float:right
    }
  }
  .order_bottom{
     width: 100%;
     height: 186px;
     padding: 10px 0 10px 0;
    p{
      line-height: 30px;
      color: #333;
      font-size: 12px;
      overflow: auto;
      time{
        float: left;
      }
      span{
        float:right
      }
    }
  }
}
</style>
